cmake_minimum_required(VERSION 2.8)

include_directories(${J2X_SRC_DIR})
link_directories(${J2X_SRC_DIR})

if(BUILD_SHARED_LIBS)
    add_executable(xml2json xml2json.cpp)
    target_link_libraries(xml2json j2x -pthread)
    install(TARGETS xml2json DESTINATION bin)

    add_executable(json2xml json2xml.cpp)
    target_link_libraries(json2xml j2x -pthread)
    install(TARGETS json2xml DESTINATION bin)
endif()

if(BUILD_STATIC_LIBS)
    add_executable(xml2json_static xml2json.cpp)
    add_definitions(-DJ2X_STATICLIB)
    target_link_libraries(xml2json_static j2x_static -pthread)
    #set_target_properties(xml2json_static PROPERTIES OUTPUT_NAME "xml2json_static")
    install(TARGETS xml2json_static DESTINATION bin)

    add_executable(json2xml_static json2xml.cpp)
    add_definitions(-DJ2X_STATICLIB)
    target_link_libraries(json2xml_static j2x_static -pthread)
    #set_target_properties(json2xml_static PROPERTIES OUTPUT_NAME "json2xml_static")
    install(TARGETS json2xml_static DESTINATION bin)
endif()


set(USE_CASES test01.xml test02.xml)
install(FILES ${USE_CASES} DESTINATION bin)
